package cn.aezo.minions.gen.mapper;

import cn.aezo.minions.gen.model.ProjectConfig;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * Created by smalle on 2017/10/21.
 */
public interface ProjectConfigDao {
    @Select("select * from project_config where project_config_id = #{projectConfigId}")
    ProjectConfig findOne(Long projectConfigId);

    @Select("select * from project_config where user_id = #{userId}")
    List<ProjectConfig> findByUserId(Long userId);

    @Insert("insert into project_config(user_id, project_name, project_package_name, database_driver, database_url, database_port, database_username, database_password, database_db_name) " +
            "values(#{userId}, #{projectName}, #{projectPackageName}, #{databaseDriver}, #{databaseUrl}, #{databasePort}, #{databaseUsername}, #{databasePassword}, #{databaseDbName})")
    int insert(ProjectConfig projectConfig);
}
